<?php

namespace App\Http\Requests\TransferController;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class TransferRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        $rules = [
            'to_username' => ['required', 'usernameExists'],
            'transfer_number' => ['required', 'integer', 'min:1'],
            'pay_password' => ['required', 'payPassword'],
        ];

        return $rules;
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'transfer_number.required' => __('转移数量必填'),
            'transfer_number.integer' => __('转移数量必须整数'),
            'transfer_number.min' => __('转移数量最低1')
        ];
    }
}
